کد تبدیل تاریخ میلادی به شمسی Public Class Form1
Public Function MiladiToShamsi(ByVal MDate As Date) As String
MiladiToShamsi = ""
Dim pc As New Globalization.PersianCalendar
Dim Sal As Integer = pc.GetYear(MDate)
Dim Mah As Integer = pc.GetMonth(MDate)
Dim Roz As Integer = pc.GetDayOfMonth(MDate)
MiladiToShamsi = Format(Sal, "0000") & "/" & Format(Mah, "00") & "/" & Format(Roz, "00")
Return MiladiToShamsi
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(MiladiToShamsi(Now))
End Sub
End Class